1. Field of the Invention
This invention relates generally to the field of computer graphics and, more particularly, to a graphics system capable of performing order-independent transparency (OIT).
2. Description of the Related Art
Transparency may be described as the quality a surface has to transmit a percentage of the light that is incident on it. When a transparent surface is situated between a viewer and an opaque surface, the color CP perceived by the viewer, when gazing along a ray that intersects both surfaces, may be modeled by a linear interpolation between the color COP of the opaque surface and the color CTR of the transparent surface as given by the formula:CP=CTRATR+COP(1−ATR),where ATR represents the coefficient of opacity of the transparent surface. (ATR=1 represents total opacity and ATR=0 represents total transparency.)
If a number of transparent surfaces intervene between the viewer and the opaque surface, the color perceived by the viewer may be computed by repeated application of the above formula, starting with the transparent surface farthest from the viewer and progressing in order of decreasing depth (i.e., towards the viewer). This process of repeated application may be described by the following recursive formula:C(n)=CTR(n)A(n)+C(n−1)(1−A(n)),for n=1, 2, 3, . . . , NS, where NS is the number of transparent surfaces. CTR(n) represents the color of the nth transparent surface in a back-to-front ordering of the transparent surfaces. A(n) is the coefficient of opacity of the nth transparent surface. C(0) is the color of the opaque surface. The color C(n) represents the combined effect of the opaque surface and the first n transparent surfaces. Similarly, the color C(n−1) represents the combined effect of the opaque surface and the first n−1 transparent surfaces.
A software application, executing on a host computer, may sort object geometry (e.g., triangles) and send the geometry to graphics hardware in back-to-front order to implement the above algorithm. The graphics hardware includes rendering circuitry to render the object geometry into fragments. When a new fragment of a transparent surface is generated for a given pixel position (x,y), the current color C(n−1) of the pixel may be read from the frame buffer and combined with the color Cf of the new fragment to determine an updated color for the pixel according to the relationC(n)=CfAf+C(n−1)(1−Af),where Af is the opacity coefficient of the new fragment. The updated color C(n) may be written back to the frame buffer.
The process of sorting triangles into a back-to-front order may be computationally expensive. Any time the virtual camera moves or one or more objects move, the triangles need to be resorted. Furthermore, there are difficult issues that software applications have to handle, such as the splitting of intersecting triangles, the sorting of triangles that are generated by hardware vertex programs, and the sorting of triangles when a pixel shader modifies the z values of triangle vertices. Thus, there exists a substantial need for graphics hardware devices capable receiving triangles in an arbitrary order and operating on the triangles to model the effect of transparency.